package com.xcc.myredis.runner;

import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import java.util.Arrays;
import java.util.stream.Collectors;

@Component
public class MyCommandLineRunner implements CommandLineRunner {

    /**
     *  如果是:java -jar spring-boot-demo.jar data1 data2 data3
     *      则输入为:===Application started with arguments:data1|data2|data3
     * @param args 获取启动后的命令参数
     */
    @Override
    public void run(String... args) throws Exception {
        String strArgs = Arrays.stream(args).collect(Collectors.joining("|"));
        System.out.println("===Application started with arguments:" + strArgs);
    }
}
